package ABC.Z314;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

public class Company {
    private String name;
    private String ad;
    private String tel;
    private String area;
    List staff=new ArrayList();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAd() {
        return ad;
    }

    public void setAd(String ad) {
        this.ad = ad;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public Company() {
    }

    public Company(String name, String ad, String tel, String area) {
        this.name = name;
        this.ad = ad;
        this.tel = tel;
        this.area = area;
    }

    public void add(Staff s){
        for(int i=0;i<staff.size();i++ ){
            if(staff.contains(s)){
                System.out.println("添加信息失败，工号重复");
                return;
            }
        }
        staff.add(s);
        System.out.println("员工信息录入成功");
    }
    public void citui(Staff s){
        if(staff.contains(s)){
            staff.remove(s);
            System.out.println("辞退成功，信息已删除");
        }else{
            System.out.println("辞退失败");
        }
    }
    public int num(){
        return staff.size();
    }

    public double salarymax(){
        double max=((Staff)(staff.get(0))).getSalary();
        for (int i=1;i<staff.size();i++){
            max=max>=((Staff)(staff.get(i))).getSalary()?max:
                    ((Staff)(staff.get(i))).getSalary();


        }
        return max;
    }
    public void staffshow(){
        for (Object o:staff){
            System.out.println(o.toString());
        }
    }
}
